package ratemymacclass

class FindAClassService {

   boolean transactional = true

   def findClass(String searchWord) {
        def classList = Course.findAll()
        def similarClass = []
        for (u in classList){
            if (u.toString().contains(searchWord.toString())){
                similarClass.add(u)
            }
        }
       return similarClass


    }

   def findProfessor(String searchWord){
        def profList = Professor.findAll()
        def similarProfs = []
        for (p in profList){
            if(p.toString().contains(searchWord)){
                similarProfs.add(p)
            }
        }
        return similarProfs
   }
}
